#define _CRT_SECURE_NO_WARNINGS 1

#include "chain_string.h"


int main() {
	LString P;
	LString T;
	LString S;
	char a[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','\0' };
	char b[] = { 'g','h','i','j','k','l','m','n','\0' };
	InitStr(&T);
	InitStr(&S);
	InitStr(&P);
	StrAssign(&T, a);
	StrAssign(&S, b);
	//Concat(&P, S, T);
	SubString(&P, T, 6, 6);
	int j = Index_BF(&T, S, 0);
	//int i = StrCompare(&T, &S);

	printf("%d", j);


	Chunk* p = P.head->next;
	int i = 0;
	while (*(p->ch+i)) {

		printf("%c", *(p->ch + i));
		i++;
		if ((i = i % CHUNKSIZE) == 0) p = p->next;
	}
	
	return 0;
}
